package cn.orange.demo;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.Toast;

public class usingRadioGroup extends Activity {
	private Button submit;
	private RadioGroup mGroup;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.using_radio_group);
		mGroup=(RadioGroup) findViewById(R.id.radioGroup1);
		findViewById(R.id.judge).setOnClickListener(new Button.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				int  check=mGroup.getCheckedRadioButtonId();
				if(check==R.id.radio0){
					new AlertDialog.Builder(usingRadioGroup.this).setTitle("ÅÐ¶Ï").setMessage("ÕýÈ·").setPositiveButton("¹Ø±Õ", null).show();
				}else if(check==R.id.radio1){
					new AlertDialog.Builder(usingRadioGroup.this).setTitle("ÅÐ¶Ï").setMessage("´íÎó").setPositiveButton("¹Ø±Õ", null).show();

				}else {
					new AlertDialog.Builder(usingRadioGroup.this).setTitle("ÅÐ¶Ï").setMessage("²»ÖªµÀÄãÃÃ°¡").setNegativeButton("ÎÒ´íÁË", new OnClickListener() {
						
						@Override
						public void onClick(DialogInterface dialog, int which) {
							Toast.makeText(usingRadioGroup.this,"ÖªµÀ´í¾ÍºÃ",Toast.LENGTH_SHORT).show();
						}
					}).setPositiveButton("ÏÂ´Î¸Ä", new OnClickListener() {
						
						@Override
						public void onClick(DialogInterface dialog, int which) {
							// TODO Auto-generated method stub
							Toast.makeText(usingRadioGroup.this,"¸ÄÁË¾ÍºÃ",Toast.LENGTH_SHORT).show();
						}
					}).show();

				}
			}
		});
		
	}
}
